#ifndef _SE_WINDOWAPI_
#define _SE_WINDOWAPI_

#include "Core/Math.hpp"

#include "Render/WindowContext.h"

#include "Core/Enums/MouseButtons.h"
#include "Core/Enums/KeyboardButtons.h"

namespace SE
{
	enum class WindowAPIType : U8
	{
		GLFW
	};

	class WindowAPI
	{
	protected:
		Weak<WindowContext> mCurrentContext;

	public:
		WindowAPI() = default;
		virtual ~WindowAPI() = default;

		static Ref<WindowContext> CreateContext();
		static void DestoryContext(const Ref<WindowContext>& context);

		static Ref<WindowAPI> Create(const WindowAPIType type);

	public:
		static WindowAPIType GetAPIType();

		static void MakeContextCurrent(const Ref<WindowContext>& context);

		static void SetTitle(const String& title);
		static void SetVSync(const Boolean vsync);
		static void SetCursorFocused(const Boolean focused);
		static void PollEvents();
		static void SwapBuffers();

		static Vector2i GetWindowSize();
		static Vector2f GetMousePosition();
		static Boolean IsMouseButtonPressed(const MouseButton button);
		static Boolean IsKeyboardButtonPressed(const KeyboardButton button);

	protected:
		virtual WindowAPIType getAPIType() const = 0;

		virtual void makeContextCurrent(const Ref<WindowContext>& context) = 0;

		virtual void setTitle(const String& title) = 0;
		virtual void setVSync(const Boolean vsync) = 0;
		virtual void setCursorFocused(const Boolean focused) = 0;
		virtual void pollEvents() = 0;
		virtual void swapBuffers() = 0;

		virtual Vector2i getWindowSize() const = 0;
		virtual Vector2f getMousePosition() const = 0;
		virtual Boolean isMouseButtonPressed(const MouseButton button) const = 0;
		virtual Boolean isKeyboardButtonPressed(const KeyboardButton button) const = 0;
	};
} // !namespace SE

#endif // !_SE_WINDOWAPI_